"""
本章节研究的是 正则表达式
"""

print("--------match方法-----------")
import re
s="python is languange python"
result=re.match("python",s) # 从头开始匹配，如果匹配成功返回匹配对象
print(result) #<re.Match object; span=(0, 6), match='python'>
print(result.span()) # (0, 6)
print(result.group()) # python


s="2python is languange python"
result=re.match("python",s) # 从头开始匹配，如果匹配成功返回匹配对象
print(result) # None


print("---------search方法--------------")
import re
s="abdrgegeeihpythobyhdyypnhnymshpythone"
result=re.search("python",s)
print(result) # <re.Match object; span=(30, 36), match='python'>
print(result.span())  # (30, 36)
print(result.group()) # python

s="intemppythob"
result=re.search("python",s)
print(result) # None


print("------findall---------")
import re
s="eurnngdriqp,klpythondebggsgqpythondttgpythondwgg"
result=re.findall("python",s)
print(result)

result=re.findall("re",s)
print(result)